﻿using modify.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;

namespace modify.Controllers
{
    public class DefaultController : Controller
    {
        private userEntities _context;
        public DefaultController()
        {
            _context = new userEntities();
        }
        // GET: Default
        public ActionResult Index()
        {
            var courses = _context.users.ToList();
            return View(courses);
        }

        public ActionResult Modify(int id)
        {
            var course = _context.users.Find(id);
            return View(course);
        }
        [HttpPost]
        public ActionResult Modify(user users)
        {
            _context.Entry(users).State = System.Data.Entity.EntityState.Modified;
            _context.SaveChanges();
            return RedirectToAction("Index");
        }
    }
}